package com.itheima.d7_generics_interface;

import java.util.ArrayList;

public class TeacherOperatorImpl1 implements dateOperator<Teacher> {

    @Override
    public void printAll(ArrayList<Teacher> teas) {
        System.out.println("-------------------------打印学成信息---------------------------");
        for (int i = 0; i < teas.size(); i++) {
            Teacher t = teas.get(i);
            System.out.println(t);
        }
        System.out.println("--------------------------------------------------------------");
    }

    @Override
    public void printAvg(ArrayList<Teacher> teas) {
        System.out.println("--------------------------打印平均成绩--------------------------");
        int total = 0;
        for (int i = 0; i < teas.size(); i++) {
            Teacher t = teas.get(i);
            total += t.getScore();
        }
        System.out.println("平均成绩为：" + total / teas.size());
    }



    }

